package DateDemo10;


import java.util.ArrayList;

public class ArrayLIst {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Student a = new Student("张三","1");
        Student b = new Student("李四","2");
        Student c = new Student("王五","3");
        list.add(a);
        list.add(b);
        list.add(c);
        System.out.println(list);

        for (int i = 0; i < list.size(); i++) {
            Student d = list.get(i);
            if (d.getName().equals("张三")){
                d.setName("张三丰");
            }if (d.getName().equals("王五")){
                list.remove(d);
            }

        System.out.println(list);
        }
    }
}
